package gr.uop.cst.context.adaptation.artifacts.oom;

import gr.uop.cst.context.adaptation.Action;
import gr.uop.cst.context.adaptation.artifacts.AbstractArtifactAdaptation;
import java.lang.reflect.Member;

/**
 *
 * @author Ioannis Bourlakos <mi49@uop.gr>
 */
public abstract class AbstractMemberAdaptation<M extends Member> extends AbstractArtifactAdaptation {

    private String clazz;
    private String member;
    
    protected AbstractMemberAdaptation(M member, Action action) {
        super(action);
        this.clazz = member.getDeclaringClass().getCanonicalName();
        this.member = member.getName();
    }
    
    public abstract M getMember() throws ClassNotFoundException, Exception;
    
    protected String getClassName() {
        return this.clazz;
    }
    
    protected String getMemberName() {
        return this.member;
    }
    
    @Override
    public String toString() {
        return this.getClass().getName() + "(" + clazz + "." + member + ")";
    }
}
